﻿Imports System.IO
Class Core
    'Change directory command
    Public Shared Sub cd(ByVal command As String)
        Dim commandArray() As String = command.Split(" ")
        If UBound(commandArray) = 1 Then
            If commandArray(1).Substring(0, 1) = "\" Then
                commandArray(1) = currentPath & commandArray(1)
            End If
            If Directory.Exists(commandArray(1)) Then
                currentPath = commandArray(1)
                pathArray = currentPath.Split("\")
                pathClean = pathArray(UBound(pathArray))
                If pathClean = "" Then
                    pathClean = currentPath
                End If
            Else
                Errors.pathNotFound()
            End If
        Else
            Errors.numArgs()
        End If
    End Sub

    Public Shared Sub current()
        Console.WriteLine("Current Directory: " & currentPath & vbCrLf)
    End Sub

End Class
